package com.example.zhihu.model;

import com.example.zhihu.base.BaseModel;
import com.example.zhihu.base.BaseObserver;
import com.example.zhihu.bean.NaviBean;
import com.example.zhihu.not.ApiService;
import com.example.zhihu.not.HttpUlist;
import com.example.zhihu.not.RxUlist;

import io.reactivex.Observable;

public class NaviModel extends BaseModel {
    public void addNaviModel(NaviCallBack callBack){
        ApiService apiServer = new HttpUlist().getApiServer(ApiService.sWanUrl, ApiService.class);
        Observable<NaviBean> navi = apiServer.getNavi();
        navi.compose(RxUlist.RxObservableTransformer())
                .subscribe(new BaseObserver<NaviBean>(this) {
                    @Override
                    protected void onSuccess(NaviBean naviBean) {
                        callBack.onSuccess(naviBean);
                    }

                    @Override
                    protected void onFail(String message) {
                        callBack.onFali(message);
                    }
                });
    }
}
